home *** CD-ROM | disk | FTP | other *** search
/ VRML 2.0 Sourcebook (2nd Edition) / VRML 2.0 Sourcebook CD [md5 fed90f4f9c39d5a60d477058775c7e21].iso / book / unix / ch27 / 27fig03.wrl < prev    next >
Text File  |  1996-09-23  |  3KB  |  119 lines

  1. #VRML V2.0 utf8
  2. # The VRML 2.0 Sourcebook
  3. # Copyright [1997] By
  4. # Andrea L. Ames, David R. Nadeau, and John L. Moreland
  5. Group {
  6.     children [
  7.         NavigationInfo {
  8.             headlight FALSE
  9.             avatarSize [ 1.0, 1.0, 0.75 ]
  10.         },
  11.     # Floor (two strips)
  12.         Transform {
  13.             translation 0.0 0.0 2.5
  14.             children DEF Floor Inline { url "dfloor.wrl" }
  15.         },
  16.         Transform { translation 0.0 0.0 -2.5 children USE Floor },
  17.     # Collision group
  18.         DEF OrbCollide Collision {
  19.             proxy Transform {
  20.                 translation 0.0 0.6 0.0
  21.                 children Shape {
  22.                     geometry Box { size 0.4 1.2 0.4 }
  23.                 }
  24.             }
  25.             children [
  26.             # Glowing orb with sound effects
  27.                 DEF OrbSpin Transform {
  28.                     translation 0.0 1.0 0.0
  29.                     children [
  30.                     # Orb light
  31.                         PointLight {
  32.                             location 0.3 0.0 0.0
  33.                             radius 10.0
  34.                             ambientIntensity 0.2
  35.                             color 0.7 0.5 0.0
  36.                         },
  37.                     # Orb itself
  38.                         Shape {
  39.                             appearance Appearance {
  40.                                 # No material, use emissive texturing
  41.                                 texture ImageTexture { url "fire.jpg" }
  42.                             }
  43.                             geometry Sphere { radius 0.2 }
  44.                         },
  45.                     # Orb sounds
  46.                         Sound {
  47.                             source AudioClip {
  48.                                 url "drone1.wav"
  49.                                 loop TRUE
  50.                             }
  51.                             intensity 0.5
  52.                         },
  53.                         DEF WispyAmp Sound {
  54.                             source DEF Wispy AudioClip {
  55.                                 url "willow1.wav"
  56.                                 stopTime 1.0
  57.                             }
  58.                             intensity 0.0
  59.                         }
  60.                     ]
  61.                 },
  62.             # Pedestal pyramid
  63.                 Shape {
  64.                     appearance DEF PedestalColor Appearance {
  65.                         material Material { }
  66.                     }
  67.                     geometry IndexedFaceSet {
  68.                         coord Coordinate {
  69.                             point [
  70.                             # Around the base
  71.                                 -0.12 0.03  0.12,   0.12 0.03  0.12,
  72.                                  0.12 0.03 -0.12,  -0.12 0.03 -0.12,
  73.                             # Tip
  74.                                  0.0  0.63  0.0,
  75.                             ]
  76.                         }
  77.                         coordIndex [
  78.                             0, 1, 4, -1,  1, 2, 4, -1,
  79.                             2, 3, 4, -1,  3, 0, 4, -1,
  80.                         ]
  81.                         solid TRUE
  82.                     }
  83.                 },
  84.             # Pedestal base
  85.                 Transform {
  86.                     translation 0.0 0.015 0.0
  87.                     children Shape {
  88.                         appearance USE PedestalColor
  89.                         geometry Box { size 0.4 0.03 0.4 }
  90.                     }
  91.                 },
  92.             ]
  93.         }
  94.     # Animation clock
  95.         DEF Clock TimeSensor {
  96.             cycleInterval 28.0
  97.         },
  98.     # Orb animation and volume control
  99.         DEF OrbSpinner OrientationInterpolator {
  100.             key [ 0.0, 0.5, 1.0 ]
  101.             keyValue [
  102.                 0.0 1.0 0.0 0.0,
  103.                 0.0 1.0 0.0 3.14,
  104.                 0.0 1.0 0.0 6.28
  105.             ]
  106.         },
  107.         DEF WispyVolume ScalarInterpolator {
  108.             key      [ 0.0, 0.1, 0.9, 1.0 ]
  109.             keyValue [ 0.0, 0.6, 0.6, 0.0 ]
  110.         }
  111.     ]
  112. }
  113. ROUTE OrbCollide.collideTime    TO Clock.set_startTime
  114. ROUTE OrbCollide.collideTime    TO Wispy.set_startTime
  115. ROUTE Clock.fraction_changed    TO OrbSpinner.set_fraction
  116. ROUTE Clock.fraction_changed    TO WispyVolume.set_fraction
  117. ROUTE OrbSpinner.value_changed  TO OrbSpin.set_rotation
  118. ROUTE WispyVolume.value_changed TO WispyAmp.set_intensity
  119.